<template>
  <div class="header">
    <div class="header-icon">
      <img class="header-icon-imge" src="../assets/images/logo.png"/>
    </div>
    <div class="login-body">
      <form novalidate="novalidate">
        <div class="row">
          <div class="input-model">
            <select class="form-control"  placeholder="请选择用户类型"  v-model="user.username">
              <option value="">请选择用户类型</option>
              <option value="1">党员</option>
              <option value="3">支部书记</option>
              <option value="2">综合党委</option>
            </select>
          </div>
        </div>
         <div class="row input-model-padding">
           <div class="input-model">
             <input style="    font-size: 14px;outline:none;" class="width-85" type="text" v-model="user.usertype" placeholder="请输入用户名称"/>
           </div>
         </div>
        <div class="row input-model-padding">
          <div class="input-model">
            <input style="font-size: 14px;outline:none;" class="width-85" type="password" v-model="user.paswored" placeholder="请输入用户密码"/>
          </div>
        </div>
        <div class="row input-model-padding paswored-input">
          <div class="left-model">
            <input   v-model="user.ispaswored" placeholder="记住密码" type="checkbox" />
            <span class="default-size">记住密码</span>
          </div>
          <div class="right-model">
            <a class="default-size" href="#">忘记密码</a>
          </div>
        </div>
        <div class="row">
          <div @click="submitlogin" class="default-size login-botton-style">
            登陆
          </div>
        </div>
      </form>
    </div>
  </div>
</template>

<script>
  import Vue from 'vue';
  import {mapState} from 'vuex';
  import {Toast} from 'mint-ui';
  import appheader from '../components/appheader';
  export default {
    data () {
      return {
       user:{
           username:"",
           usertype:"",
           paswored:"",
           ispaswored:"0"
       }
      }
    },
    methods: {
      async getContent () {
        const response = await fetch('/api/login');
        this.content = await response.text();
      },
        submitlogin: function() {
          function showmenage(menage) {
              Toast({
                  message: menage,
                  position: 'middle',
                  duration: 2000
              });
          }
         if(!this.user.usertype){
             showmenage("请选择登陆类型");
             return;
         }else if(!this.user.username){
             showmenage("请输入正确的账号名称");
             return;
         }else if(!this.user.paswored){
             showmenage("请输入正确的账号密码");
             return;
         }
            this.$router.push({name:'jifen',params:{
                id:this.user.username//
            }})
        },
    },
    mounted () {
        console.log(this.includedComponents);
      this.$store.commit('message', '欢迎使用 vue！');
      this.getContent();
    },
    components: {
        'Toast':Toast,
        'appheader':appheader
    }
  }
</script>

<style lang="scss" rel="stylesheet/scss" scoped>
  select {
    /*美化样式*/
    display: block;
    width: 100%;
    padding: .5rem .75rem;
    font-size: 1rem;
    line-height: 1.25;
    color: #F0F0F0;
    border: none;
    /*Chrome和Firefox里面的边框是不一样的，
    所以复写了一下*/
    /*很关键：将默认的select选择框样式清除*/
    appearance:none;
    -moz-appearance:none;
    -webkit-appearance:none;
    /*为下拉小箭头留出一点位置，避免被文字覆盖*/
    padding-right: 14px;
    padding-left:10px;
    background:url("../assets/images/select5.png")  no-repeat scroll 95% 55% #F0F0F0;
    background-color: transparent;
  }
  /*清除ie的默认选择框样式清除，隐藏下拉箭头*/
  select::-ms-expand {
    display: none;
  }
  select option{
    background-color: #242528;
  }
  input{
    autocomplete:on;
    /*-webkit-box-shadow: 0 0 0px 1000px #202126 inset;*/
    color:#ffffff !important;
  }

  .header{
    position: absolute;
    top: 60px;
    right: 58px;
    left: 58px;
  }
  .login-body{
    margin-top: 38px;
  }
  .input-model-padding{
    padding-top: 30px;
    .input-model-radio{
      background-color: transparent;
    }
    .left-model{
      width: 50%;
      text-align: left;
      input{
        //下划线
        text-decoration: underline;
        color: #F0F0F0;
        margin-left: 20px;
      }
    }
    .right-model{
      width: 50%;
      text-align: right;
      a{
        //下划线
        text-decoration: underline;
        color: #F0F0F0;
        margin-right: 20px;
      }
     }
  }
  .input-model{
    border: 2px solid #F0F0F0;
    border-radius: 20px;
    width:100%;
    input{
      background-color: transparent;
      border-radius: 20px;
      border:none;
      padding: 5px;
      color: #F0F0F0 !important;
      font-size: 14px !important;
    }
  }
  .form-control {
    display: block;
    height: 36px;
    font-size: 14px;
    line-height: 1.42857143;
    width: 100%;
  }
  .header-icon{
    display: flex;
    flex-direction: row;
    text-align: center;
    justify-content: center;
    .header-icon-imge{
      width:92px;
      height:92px;
      border: none;

    }
    .paswored-input{
      padding-top: 15px;
      padding-bottom: 15px;
    }
  }
  .login-botton-style{
    width: 100%;
    text-align: center;
    display: flex;
    justify-content: center;
    -webkit-justify-content: center;
    -webkit-align-items: center;
    align-items: center;
    margin-top: 8px;
    background-color: #9a773e;
    height: 38px;
    box-shadow: crimson;
    -moz-box-shadow: 10px 10px 5px #888888;
    -moz-box-shadow: 1px 0px 20px #9A773E, 2px 2px 5px #333333;
    -webkit-box-shadow: 1px 0px 20px #9A773E, 2px 2px 5px #333333;
    box-shadow: 1px 0px 13px #9A773E, 2px 2px 2px #333333;
    border-radius: 20px;
  }
   input,select{
     padding-left: 19px !important;
   }
  .width-85{
    width:90%;
  }




</style>
